﻿Imports Microsoft.Reporting.WinForms

Public Class ViewReport
    Public Property strReport As String
    Public dsReport As DataSet

    Private Sub ViewReport_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        If (strReport Is Nothing) Then
            strReport = "COA"
        End If
        Dim rptCompany As New ReportDataSource
        rptCompany.Name = "dsCompany"
        rptCompany.Value = New company().SetDetail()
        Select Case strReport
            Case "COA"
                Dim rptDataSource As New ReportDataSource
                rptDataSource.Name = "dsCOA"
                rptDataSource.Value = dsReport.Tables(0) 'ListCOA.GetdsCOA("01").Tables(0)

                With rptViewer.LocalReport
                    .DataSources.Clear()
                    .DataSources.Add(rptDataSource)
                    .DataSources.Add(rptCompany)
                    .ReportEmbeddedResource = "prot_smalticeram.rptCOA.rdlc"
                End With
            Case "Journal"
                Dim rptDataSource As New ReportDataSource
                rptDataSource.Name = "dsJournal"
                rptDataSource.Value = dsReport.Tables(0)

                With rptViewer.LocalReport
                    .DataSources.Clear()
                    .DataSources.Add(rptDataSource)
                    .DataSources.Add(rptCompany)
                    .ReportEmbeddedResource = "prot_smalticeram.rptJournalGL.rdlc"
                End With
        End Select
        Me.rptViewer.RefreshReport()
    End Sub
End Class